import { OrderDiscount } from './orderDiscount';
import { OrderPayment } from './orderPayment';
import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
@Define.Table({ TableName: "duty" })
export class Duty extends EntityObjectType<Duty>{
    @Define.PrimaryKey()
    id: string;

    /**
     * 开班时间
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.BIGINT,
        NotAllowNULL: true
    })
    beginTime: number;

    /**
     * 交班时间
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.BIGINT,
    })
    endTime: number;

    /**
     * 班次收银员Id
     *
     * @type {string}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    operatorId: string;

    /**
     * 班次收银员名称
     *
     * @type {string}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    operatorName: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    status: string;

    /**
     * 班次营业额
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.Decimal,
        DefaultValue: 0
    })
    turnover: number;

    /**
     * 备用金
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.Decimal,
        DefaultValue: 0
    })
    reserveAmount: number;

    /**
     * 订单总数
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.INT,
        DefaultValue: 0
    })
    totalOrderCount: number;

    /**
     * 折扣总额
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.Decimal,
        DefaultValue: 0
    })
    totalDiscount: number;

    /**
     * 已支付金额
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.Decimal,
        DefaultValue: 0
    })
    paidAmount: number;

    /**
     * 会员充值金额
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.Decimal,
        DefaultValue: 0
    })
    memberRecharge: number;

    /**
     * 会员充值订单数量
     *
     * @type {number}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.INT,
        DefaultValue: 0
    })
    memberRechargeOrderCount: number;

    /**
     * 班次终端
     *
     * @type {string}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    terminalId: string;

    /**
     * 终端名称
     *
     * @type {string}
     * @memberof Duty
     */
    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    terminalName: string;

    @Define.Column({
        DataType: Define.DataType.JSON,
    })
    orderPayments = [];

    @Define.Column({
        DataType: Define.DataType.JSON,
    })
    orderDiscounts = [];

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        DataLength: 1000
    })
    note: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;
}

export const DutyStatus = {
    Opend: 'opend',
    Closed: 'closed'
}